package org.travel_system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.travel_system.mapper.ReservationMapper;
import org.travel_system.pojo.Reservation;
import org.travel_system.service.ReservationService;

import java.util.List;

@Service
public class ReservationServiceImpl implements ReservationService {

    private final ReservationMapper reservationMapper;

    @Autowired
    public ReservationServiceImpl(ReservationMapper reservationMapper) {
        this.reservationMapper = reservationMapper;
    }

    @Override
    public List<Reservation> findAllReservations() {
        return reservationMapper.findAllReservations();
    }

    @Override
    public List<Reservation> findUserReservations(int userId) {
        return reservationMapper.findUserReservations(userId);
    }

    @Override
    public Reservation findReservationById(int id) {
        return reservationMapper.findReservationById(id);
    }

    @Override
    public int createReservation(Reservation reservation) {
        return reservationMapper.createReservation(reservation);
    }

    @Override
    public int updateReservation(Reservation reservation) {
        return reservationMapper.updateReservation(reservation);
    }

    @Override
    public int deleteReservation(int id) {
        return reservationMapper.deleteReservation(id);
    }
}
